package com.sc.nft.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sc.nft.dao.DaoPropsReleasedConfigDao;
import com.sc.nft.entity.DaoPropsReleasedConfig;
import com.sc.nft.service.DaoPropsReleasedConfigService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
public class DaoPropsReleasedConfigServiceImpl implements DaoPropsReleasedConfigService {
    private final DaoPropsReleasedConfigDao daoPropsReleasedConfigDao;


    @Override
    public String getActivityRulesImageUrl(Long daoId) {
        LambdaQueryWrapper<DaoPropsReleasedConfig> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(daoId != null, DaoPropsReleasedConfig::getDaoId, daoId);
        DaoPropsReleasedConfig daoPropsReleasedConfig = daoPropsReleasedConfigDao.getOne(wrapper);
        if (daoPropsReleasedConfig == null) {
            return null;
        }
        return daoPropsReleasedConfig.getActivityRulesImageUrl();
    }

    @Override
    public DaoPropsReleasedConfig getDaoPropsReleasedConfig(Long daoId) {
        LambdaQueryWrapper<DaoPropsReleasedConfig> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(daoId != null, DaoPropsReleasedConfig::getDaoId, daoId);
        DaoPropsReleasedConfig daoPropsReleasedConfig = daoPropsReleasedConfigDao.getOne(wrapper);
        if (daoPropsReleasedConfig == null) {
            return null;
        }
        return daoPropsReleasedConfig;
    }
}
